FROM php:7.4-fpm-alpine

# 设置时区
ENV TZ Asia/Shanghai

# 创建supervisor进程管理器相关数据存在的文件夹
RUN mkdir -p "/var/log/supervisor" && mkdir -p "/var/run"

# 设置源，提高下载效率
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

# 安装系统依赖
RUN apk update && apk --no-cache add \
    autoconf \
    g++ \
    make \
    openssl-dev \
    libzip-dev \
    unzip \
    tzdata \
    supervisor

# 安装Redis扩展
RUN pecl install redis && docker-php-ext-enable redis

# 安装PDO MySQL扩展
RUN docker-php-ext-install pdo_mysql && docker-php-ext-enable pdo_mysql

# 安装opcache扩展
RUN docker-php-ext-install opcache && docker-php-ext-enable opcache

# 安装Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

#工作目录
WORKDIR /app

# 定义容器启动时运行的命令
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]